package com.ofps.web.controller.forms;

import com.ofps.forms.common.utils.R;
import com.ofps.forms.domain.QuestionCheckbox;
import com.ofps.forms.service.QuestionCheckboxService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;


/**
 * @author pyn
 * @date 2022-05-17 11:26:55
 */
@RestController
@RequestMapping("questioncheckbox")
public class QuestionCheckboxController {
    @Autowired
    private QuestionCheckboxService questionCheckboxService;


    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("questioncheckbox:save")
    public R save(HttpServletRequest request, @RequestBody QuestionCheckbox questionCheckbox) {
        return questionCheckboxService.save(request, questionCheckbox);
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("questioncheckbox:update")
    public R update(@RequestBody QuestionCheckbox questionCheckbox) {
        return questionCheckboxService.updateById(questionCheckbox) ? R.ok("更新成功") : R.error("更新失败");
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("questioncheckbox:delete")
    public R delete(@RequestBody Map<String, Object> body) {
        return questionCheckboxService.delete(body);
    }

}
